<template>
  <el-container class="home-content">
    <el-aside width="200">
      <h2 class="hh">万锋智慧</h2>
      <!-- 菜单组件 -->
      <submenu></submenu>
    </el-aside>
    <el-container>
      <el-header>
        <el-row type="flex" class="row-bg" justify="space-between">
          <el-col :span="8">
            <div class="grid-content shouqi" @click="change">
              <i class="el-icon-s-fold" v-if="!$store.state.isCollapse"></i>
              <i class="el-icon-s-unfold" v-else></i>
            </div>
          </el-col>
          <el-col :span="8">
            <div class="grid-content title">
              <h2>后台管理系统</h2>
            </div>
          </el-col>
          <el-col :span="8">
            <div class="grid-content info">
              <el-avatar :size="50" :src="userInfo.headimgurl"></el-avatar>
              <b class="infoName" v-text="userInfo.nickname"></b>
              <a href="javascript:;" class="out" @click="leave">退出</a>
            </div>
          </el-col>
        </el-row>
      </el-header>
      <el-main>
        <!-- 面包屑 -->
        <el-breadcrumb separator-class="el-icon-arrow-right">
          <el-breadcrumb-item :to="{ path: '/welcome' }"
            >首页</el-breadcrumb-item
          >
          <el-breadcrumb-item>学员管理</el-breadcrumb-item>
          <el-breadcrumb-item>学院项目管理</el-breadcrumb-item>
          <!-- <el-breadcrumb-item>活动详情</el-breadcrumb-item> -->
        </el-breadcrumb>
        <router-view style="margin: 30px 10px"></router-view>
      </el-main>
    </el-container>
  </el-container>
</template>

<script>
// import * as api from "@/api";
import { mapState, mapMutations, mapActions } from "vuex";
import submenu from "@/components/Submenu";

export default {
  components: {
    submenu,
  },
  data() {
    return {};
  },
  methods: {
    ...mapMutations(["CHANGEMENU"]),
    ...mapActions(["GET_MENU"]),
    //触发Mutations的CHANGEMENU
    change() {
      this.$store.commit("CHANGEMENU");
    },

    leave() {
      this.$router.push("/login");
      localStorage.removeItem("qf-token");
    },
  },
  mounted() {
    // loginLogApi()
    // .then(res=>{
    //   console.log(res);
    // })
    // api.menuListApi()
    // .then(res=>{
    //   console.log(res);
    //   let reslist=recursionRoutes(allRoutes,res.data.menuList)
    //   console.log(reslist);
    // })
  },
  computed: {
    ...mapState(["userInfo"]),
  },
};
</script>

<style lang="less" scoped>
#app {
  height: 100%;
}
.el-header,
.el-footer {
  background: linear-gradient(rgb(255, 135, 195), rgb(253, 195, 224));
  color: rgb(105, 105, 105);
  text-align: center;
}

.el-aside {
  background: linear-gradient(rgb(255, 135, 195), rgb(255, 218, 237));
  color: #333;
  text-align: left;
}
.hh {
  line-height: 60px;
  text-align: center;
  color: rgb(105, 105, 105);
}
.el-main {
  background-color: #e9eef3;
  color: #333;
  // text-align: center;
  // line-height: 160px;
  overflow: auto;
}

.el-container:nth-child(5) .el-aside,
.el-container:nth-child(6) .el-aside {
  line-height: 260px;
}

.el-container:nth-child(7) .el-aside {
  line-height: 320px;
}
//el-row
.el-row {
  margin-bottom: 20px;
  &:last-child {
    margin-bottom: 0;
  }
}
.el-col {
  border-radius: 4px;
}
.bg-purple-dark {
  background: #99a9bf;
}
.bg-purple {
  background: #d3dce6;
}
.bg-purple-light {
  background: #e5e9f2;
}
.grid-content {
  border-radius: 4px;
  min-height: 36px;
  h2 {
    padding-top: 5px;
  }
}
.row-bg {
  padding: 5px 0;
  background: linear-gradient(rgb(255, 135, 195), rgb(253, 195, 224));
}
.el-icon-s-fold,
.el-icon-s-unfold {
  font-size: 40px;
}
.shouqi {
  text-align: left;
}
.el-avatar--circle {
  vertical-align: middle;
}
.infoName {
  padding: 0 10px;
}
.out {
  color: rgb(105, 105, 105);
}
</style>
